function y = ave(x)
% AVERAGE Mean of vector elements.
% AVERAGE(X), where X is a vector, is themean of vector elements.
% Nonvector input results in an error .
[m,n]=size(x);
if (~((m==1)|(n==1))|(m==1& n==1))
 error('input must be a bector')
end
y = sum (x)/length(x);

